﻿
GO
IF NOT EXISTS ( SELECT  1
                FROM    syscolumns
                WHERE   id = OBJECT_ID('FX_Group')
                        AND name = 'RoleKey' )
BEGIN
       PRINT('FX_Group表加入字段RoleKey')
      alter table [FX_Group] add [RoleKey] varchar(50) NULL
END
GO
IF NOT EXISTS ( SELECT  1
                FROM    syscolumns
                WHERE   id = OBJECT_ID('FX_Group')
                        AND name = 'PGID' )
BEGIN
       PRINT('FX_Group表加入字段PGID')
      alter table [FX_Group] add [PGID] varchar(50) NULL
END
GO
GO
IF NOT EXISTS ( SELECT  1
                FROM    syscolumns
                WHERE   id = OBJECT_ID('FX_Group')
                        AND name = 'RankID' )
BEGIN
       PRINT('FX_Group表加入字段RankID')
      alter table [FX_Group] add [RankID] varchar(50) NULL
END
GO
GO
IF NOT EXISTS ( SELECT  1
                FROM    syscolumns
                WHERE   id = OBJECT_ID('FX_Group')
                        AND name = 'RoleType' )
BEGIN
       PRINT('FX_Group表加入字段RoleType')
      alter table [FX_Group] add [RankID] varchar(50) NULL
END
GO    
if not EXISTS (select * from sysobjects where id = object_id('FX_Chat'))
BEGIN
CREATE TABLE [dbo].[FX_Chat](
	[ChatID] [nvarchar](50) NULL,
	[ChatName] [nvarchar](50) NULL,
	[ChatType] [nvarchar](50) NULL,
	[ChatState] [nvarchar](50) NULL,
	[ChatTime] [datetime] NULL
) ON [PRIMARY]
PRINT('加入FX_Chat表')
END
GO
if not EXISTS (select * from sysobjects where id = object_id('FX_ChatRecord'))
BEGIN
CREATE TABLE [dbo].[FX_ChatRecord](
	[ChatMsgID] [nvarchar](50) NULL,
	[SendContent] [text] NULL,
	[SendText] [text] NULL,
	[SendTime] [datetime] NULL,
	[Sender] [nvarchar](50) NULL,
	[ChatID] [nvarchar](50) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
PRINT('加入FX_ChatRecord表')
END
GO
if not EXISTS (select * from sysobjects where id = object_id('FX_ChatUserR'))
BEGIN
CREATE TABLE [dbo].[FX_ChatUserR](
	[ChatID] [nvarchar](50) NULL,
	[UserID] [nvarchar](50) NULL,
	[UserRole] [nvarchar](50) NULL,
	[UserState] [nvarchar](50) NULL
) ON [PRIMARY]
PRINT('加入FX_ChatUserR表')
END
